﻿@using Seal.Model;
@{
    ReportViewTemplate Template = Model;

    //Template Name
    Template.Name = ReportViewTemplate.ChartJSName;
    Template.Description = "Render the Chart JS series of the page result.";

    //If true, the view can be configured for a report model
    Template.ForReportModel = false;
    Template.IsModelViewChild = true;

    //Parameters for this template
    Template.Parameters.Add(new Parameter() { Name = "chartjs_width", DisplayName = "Chart width", Description = "The chart width. Valid only when the chart is not responsive (Set Is Responsive to False).", Enums = new string[] { "", "300px", "400px", "600px", "80%" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_height", DisplayName = "Chart height", Description = "The chart height. Valid only when the chart is not responsive (Set Is Responsive to False).", Enums = new string[] { "", "300px", "400px", "600px", "80%" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_responsive", BoolValue = true, DisplayName = "Is responsive", Description = "If true, the chart size is automatic (responsive)." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_maintainratio", BoolValue = false, DisplayName = "Maintain Width/Height ratio", Description = "If true, the original canvas aspect ratio (width / height) is kept when resizing. Valid only when the chart is responsive  (Set Is Responsive to True)." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_contwidth", DisplayName = "Chart width in container", Description = "The width of chart in its container (vw is the % of the viewport width). Valid only when the chart is responsive  (Set Is Responsive to True).", Enums = new string[] { "", "100vw", "90vw", "50vw", "400px" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_contheight", TextValue = "400px", DisplayName = "Chart height in container", Description = "The height of the chart in its container (vh is the % of the viewport height). Valid only when the chart is responsive  (Set Is Responsive to True).", Enums = new string[] { "100vh", "90vh", "50vh", "400px" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_show_legend", DisplayName = "Show legend", BoolValue = true, Description = "If true, the legend is displayed in the chart." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_legend_position", DisplayName = "Legend position", Description = "The position of the legend in the chart.", Value = "top", Enums = new string[] { "top|Top", "left|Left", "right|Right", "bottom|Bottom" } });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_show_xaxis", DisplayName = "Show X Axis", BoolValue = true, Description = "If true, the X Axis is displayed in the chart." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_show_yaxis", DisplayName = "Show Y Axis", BoolValue = true, Description = "If true, the Y Axis is displayed in the chart." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_title", DisplayName = "Title", Description = "Optional title displayed for the Chart JS. To handle drill navigation, the title can contain element label keyword like '%Label Text%' that will be replaced (e.g. 'Sales per %Order Month%')'." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_title_position", DisplayName = "Title position", Description = "The position of the title in the chart.", Value = "top", Enums = new string[] { "top|Top", "left|Left", "right|Right", "bottom|Bottom" } });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_xaxis_title", DisplayName = "X Axis: Title", Description = "Optional title displayed for the X Axis. To handle drill navigation, the title can contain element label keyword like '%Label Text%' that will be replaced (e.g. 'Sales per %Order Month%')'." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_xaxis_count", DisplayName = "X Axis: Number of values", NumericValue = 0, Description = "Number of X Axis values to display in the chart (e.g. to show the top 10 values). If 0, all the values are shown." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis_title", DisplayName = "Y Axis: Title", Description = "Optional title displayed for the Y Axis. To handle drill navigation, the title can contain element label keyword like '%Label Text%' that will be replaced (e.g. 'Sales per %Order Month%')'." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis_min", DisplayName = "Y Axis: Minimum value", Description = "Minimum value of the axis." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis_max", DisplayName = "Y Axis: Maximum value", Description = "Maximum value of the axis." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis_stepsize", DisplayName = "Y Axis: Step size", Description = "User defined fixed step size for the scale." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis2_title", DisplayName = "Secondary Y Axis: Title", Description = "Optional title displayed for the secondary Y Axis. To handle drill navigation, the title can contain element label keyword like '%Label Text%' that will be replaced (e.g. 'Sales per %Order Month%')'." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis2_min", DisplayName = "Secondary Y Axis: Minimum value", Description = "Minimum value of the secondary axis." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis2_max", DisplayName = "Secondary Y Axis: Maximum value", Description = "Maximum value of the secondary axis." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_yaxis2_stepsize", DisplayName = "Secondary Y Axis: Step size", Description = "User defined fixed step size for the scale of the secondary axis." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_bar_stacked", DisplayName = "Bar: Is stacked", BoolValue = false, Description = "If true, the Bar in chart are stacked (only for Bar chart)." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_bar_horizontal", DisplayName = "Bar: Horizontals", BoolValue = false, Description = "If true, the bars in the chart are horizontals (only for Bar chart)." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_doughnut", DisplayName = "Pie: Is doughnut", BoolValue = true, Description = "If true, the chart is a doughnut (only for Pie chart)." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_stepped_line", DisplayName = "Line: Stepped", Description = "Stepped line mode (only for Line chart).", Value = "false", Enums = new string[] { "false|No Step Interpolation (default)", "true|Step-before Interpolation", "'after'|Step-after Interpolation" } });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_fill", DisplayName = "Line or Radar: Fill area", Description = "Option used to create area between two datasets or a dataset and a boundary (only for Line or Radar chart).", Value = "false", Enums = new string[] { "true", "false", "'start'", "'end'", "'origin'", "1", "2", "3", "'-1'", "'-2'", "'-3'", "'+1'" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_colors", DisplayName = "Colors", Description = "The list of colors used for the series (list of strings). By default, d3.scale.category10 or 20 colors are used.", Value = "d3", Enums = new string[] { "d3|D3 (default)", ReportViewTemplate.GoogleColors + "|Google", "d3b|D3 Category 20B Palette", "d3c|D3 Category 20C Palette", ReportViewTemplate.D3Colors }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_color_mappings", DisplayName = "Color mappings", Description = "If set, list of colors to use for specific label values. The mapping definition is an array of pair label and color (e.g. 'ok':'green','ko':'red').", Value = "", Enums = new string[] { "'ok':'green','ko':'red'" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_point_radius", NumericValue = 3, DisplayName = "Point radius", Description = "Point size in pixels for Line chart." });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_padding", DisplayName = "Padding", Description = "Padding applied in pixels to all sides of the chart (left, top, right, bottom).", Value = "left:0, right:10, top:0, bottom:0" });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_unit", DisplayName = "Time Unit", Description = "Unit applied for chart having a Date Time axis.", Enums = new string[] { "|default", "second", "minute", "hour", "day", "week", "month", "quarter", "year" }, UseOnlyEnumValues = true });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_step_size", DisplayName = "Time Step Size", Description = "The number of units between grid lines for chart having a Date Time axis.", NumericValue = 1 });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_display", DisplayName = "Label: Display type", Description = "Visibility of labels. If 'auto', the label is hidden if it overlap with another label.", Value = "false", Enums = new string[] { "false", "auto", "true", "thr_val|Threshold on value", "thr_per|Threshold on percentage" }, UseOnlyEnumValues = true });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_series", DisplayName = "Label: Series with hidden labels", Description = "If labels are visible, list of indexes (0 based) separated by semi-columns of the Series to ignore the labels. The keyword '{LAST}' can be used to specify the last serie.", Value = "", Enums = new string[] { "0", "1", "0;2", "{LAST}", "0;{LAST}", "0;{LAST}-1" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_threshold", DisplayName = "Label: Threshold for display", Description = "Threshold value or percentage to reach to display the label if the display type is 'Threshold'.", Value = "10" });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_border", DisplayName = "Label: Border style", Description = "Several properties to defined the label .", Value = "borderRadius:4", Enums = new string[] { "borderColor:'black',borderRadius:4,borderWidth:2" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_font", DisplayName = "Label: Font style", Description = "The font style used for the label.", Value = "size:12,style:'normal',weight:'bold'" });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_color", DisplayName = "Label: Color", Description = "The color used for the label.", Value = "white", Enums = new string[] { "white", "black", "#666" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_back_color", DisplayName = "Label: Background color", Description = "The color used for the background. If 'auto', the Serie color is used.", Value = "auto", Enums = new string[] { "auto", "white", "black", "#666" }, UseOnlyEnumValues = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_clamp", DisplayName = "Label: Clamp", Description = "If true, enforces the anchor position to be calculated based on the visible geometry of the associated element.", BoolValue = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_clip", DisplayName = "Label: Clip", Description = "If true, the part of the label which is outside the chart area will be masked ", BoolValue = false });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_anchor", DisplayName = "Label: Anchor", Description = "Anchor point of the label defined by an orientation vector and a position on the data element.", Value = "center", Enums = new string[] { "center", "start", "end" }, UseOnlyEnumValues = true });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_align", DisplayName = "Label: Alignment", Description = "Position of the label relative to the anchor point position and orientation.", Value = "center", Enums = new string[] { "center", "start", "end", "right", "bottom", "left", "top" }, UseOnlyEnumValues = true });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_label_format", DisplayName = "Label: Type", Description = "Type of values shown in the label. If 'auto', the format depends on the chart type (e.g. percentage is displayed for pie charts).", Value = "auto", Enums = new string[] { "auto", "val|value", "per|percentage", "vp|value and percentage" }, UseOnlyEnumValues = true });
    Template.Parameters.Add(new Parameter() { Name = "chartjs_tooltip_format", DisplayName = "Tooltip: Type", Description = "Type of values shown in the tooltip. If 'auto', the format depends on the chart type (e.g. percentage is displayed for pie charts).", Value = "auto", Enums = new string[] { "auto", "val|value", "per|percentage", "vp|value and percentage" }, UseOnlyEnumValues = true });

    //Allowed template parent names
    Template.ParentNames = new List<string>() { "Model", "Container", "Container Grid Flex", "Widget", "Tab Page" };
}
